//
//  HJGroupNoticeCell.m
//  KaiChat
//
//  Created by lx on 2023/11/6.
//

#import "HJGroupNoticeCell.h"
#import "HJChatGroupModel.h"

@interface HJGroupNoticeCell()

@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UILabel *contentLabel;

@end


@implementation HJGroupNoticeCell

- (void)settingSubView {
    [super settingSubView];
    
    UILabel *titleLabel = [UILabel lableWithSuperView:self.contentView font:UIFontMediumMake(14) color:UIColor.tj_333333Color title:nil textAlignment:NSTextAlignmentLeft];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(16);
        make.left.offset(leftRightMargin);
    }];
    
    UILabel *contentLabel = [UILabel lableWithSuperView:self.contentView font:UIFontMake(12) color:UIColor.tj_333333Color title:nil textAlignment:NSTextAlignmentLeft];
    contentLabel.numberOfLines = 3;
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(titleLabel.mas_bottom).offset(9);
        make.left.right.inset(leftRightMargin);
    }];
    
    UIImageView *arrowImageView = [UIImageView addToView:self.contentView];
    arrowImageView.image = [UIImage imageNamed:@"cell_arrow"];
    [arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.inset(leftRightMargin);
        make.centerY.equalTo(titleLabel);
    }];
    
    _titleLabel = titleLabel;
    _contentLabel = contentLabel;
}

- (void)setModel:(HJCellModel *)model {
    _model = model;
    
    _titleLabel.text = model.text;
    
    HJChatGroupModel *groupModel = model.anyObject;
    if (isEmptyString(groupModel.notice)) {
        _contentLabel.text = @"Not set";
        _contentLabel.textColor = UIColor.tj_BEBDCAColor;
    } else {
        _contentLabel.text = groupModel.notice;
        _contentLabel.textColor = UIColor.tj_868391Color;
    }
}
 

@end
